//
//  PhotoDetailTableViewCell.m
//  CommonFrame
//
//  Created by Bang-guo on 15/7/23.
//  Copyright (c) 2015年 guobang. All rights reserved.
//

#import "PhotoDetailTableViewCell.h"

@implementation PhotoDetailTableViewCell
-(instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
        
    }
    return self;
}

-(void)createSubViews {

    self.photoImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 20, WIDTH, WIDTH)];
    [self.contentView addSubview:self.photoImageV];
    
    self.contentL = [[BaseLabel alloc] initWithFrame:CGRectMake(5, WIDTH + 20, WIDTH - 10, HEIGHT - 113 - 40 - WIDTH)];
    [self.contentView addSubview:self.contentL];
    self.contentL.font = [UIFont systemFontOfSize:15.0];
    self.contentL.numberOfLines = 0;
    self.contentL.textColor = [UIColor whiteColor];
    
    
    self.addrAndTimeL = [[BaseLabel alloc] initWithFrame:CGRectMake(0, HEIGHT - 113 - 20, WIDTH, 20)];
    self.addrAndTimeL.textAlignment = NSTextAlignmentCenter;
    self.addrAndTimeL.font = [UIFont systemFontOfSize:15.0];
    self.addrAndTimeL.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.addrAndTimeL];

}

-(void)setPhoto:(NearbyPhoto *)photo {
    
    if (_photo != photo) {
        
        _photo = photo;
    }
    
    [self.photoImageV sd_setImageWithURL:[NSURL URLWithString:photo.photo_s] placeholderImage:[UIImage imageNamed:@"icon1024.png"]];
    NSString *str = [NSString stringWithFormat:@"%@", photo.local_time];
    self.addrAndTimeL.text = str;
    
    self.contentL.text = photo.text;

    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
